package com.arpa.wms.service;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.WarehouseSpaceDTO;
import com.arpa.wms.domain.entity.WarehouseSpace;
import com.arpa.wms.domain.vo.WarehouseSpaceVO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 库区 服务类
 * </p>
 *
 * @author LEO
 * @since 2020-08-03
 */
public interface IWarehouseSpaceService extends IService<WarehouseSpace> {

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(WarehouseSpace entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(WarehouseSpace entity);

    /**
     * 查询列表
     * @param warehouseSpaceDTO
     * @return
     */
    List<WarehouseSpaceVO> queryList(WarehouseSpaceDTO warehouseSpaceDTO);

    /**
     * 查询合计,包含总数
     * @param warehouseSpaceDTO
     * @return
     */
    WarehouseSpaceVO queryListSum(WarehouseSpaceDTO warehouseSpaceDTO);

    /**
     * 启用库区
     * @param code
     * @return
     */
    int activeStatus(List<String> code);

     /**
      *  @author: Allen chen
      *  @Date: 2020/10/15 15:01
      *  @Description: 根据仓库code启用仓库的临时库区
      */
    int activeStatusByWarehouseCodes(List<String> warehouseCodes);

    /**
     * 停用库区
     * @param code
     * @return
     */
    Map<String,Object> unactiveStatus(List<String> code);

    /**
     * 校验库区信息
     * @param entity
     * @return
     */
    Result validateSpace(WarehouseSpace entity);

    /**
     * 根据code获取仓库库区信息
     * @param code
     * @return
     */
    WarehouseSpace getByCode(String code);

    /**
     * 通过code获取库区详细信息
     * @param code
     * @return
     */
    WarehouseSpaceVO getWarehouseSpace(String code);

    /**
     * 删除库区
     * @param code
     */
    Result deleteByCode(List<String> code);

    /**
     * 前台页面库区下拉数据
     * 查询当前登录用户所属机构下启用的仓库库区
     * @param warehouseCode
     * @return
     */
    List<WarehouseSpaceVO> findWarehouseSpace(String warehouseCode);

    /**
     * 前台页面库区下拉数据, 包含临时库区信息
     * 查询当前登录用户所属机构下启用的仓库库区
     * @param warehouseCode
     * @return
     */
    List<WarehouseSpaceVO> findAllWarehouseSpace(String warehouseCode);

    Map<String,Object> batchdel(List<String> codes);

    /**
     *  @author: Allen chen
     *  @Date: 2020/10/10 9:14
     *  @Description: 根据code批量查询
     */
    List<WarehouseSpaceVO> queryByCodes(List<String> codes);

    /**
     * 创建临时库区
     * @param warehouseCode
     * @return
     */
    WarehouseSpace createTempSpace(String warehouseCode);
}
